/*
 * Quote.cpp
 *
 */

#include "Quote.h"

Quote::Quote(): id(0), serviceId(0), userId(0) {}

Quote::~Quote() {}

Quote::Quote(BigInt id, BigInt serviceId, BigInt userId, const String& text, const String& date, const String& time):
	id(id), serviceId(serviceId), userId(userId), text(text), date(date), time(time) {}

Quote::Quote(const Quote& copy) {
	id = copy.id;
	serviceId = copy.serviceId;
	userId = copy.userId;
	text = copy.text;
	date = copy.date;
	time = copy.time;
}

Quote& Quote::operator =(const Quote& other) {
	id = other.id;
	serviceId = other.serviceId;
	userId = other.userId;
	text = other.text;
	date = other.date;
	time = other.time;
	return *this;
}

BigInt Quote::size() const {
	return 3 + 3*sizeof(BigInt) + text.length() + date.length() + time.length();
}

void Quote::serialize(ISerializer& serializer) const {
	serializer.serializeUnsignedLongInt(id);
	serializer.serializeUnsignedLongInt(serviceId);
	serializer.serializeUnsignedLongInt(userId);
	serializer.serializeString(text);
	serializer.serializeString(date);
	serializer.serializeString(time);
}

void Quote::unserialize(IUnserializer& unserializer) {
	id = unserializer.unserializeUnsignedLongInt();
	serviceId = unserializer.unserializeUnsignedLongInt();
	userId = unserializer.unserializeUnsignedLongInt();
	text = unserializer.unserializeString();
	date = unserializer.unserializeString();
	time = unserializer.unserializeString();
}
